import { api } from '../boot/axios';

// export function getreport(pram){
//   return api({
//     url: '/api/report/get_igi_report/',
//     method: 'get',
//     data:pram
//   });
// }
export function getreportipi(
    completed: boolean,
    stock_code: string,
    start_date:string,
    end_date:string) {
    return api({
      url: '/api/report/get_igi_report/',
      method: 'post',
      data: {
        completed,
        stock_code,
        start_date,
        end_date,
      },
      responseType: 'blob',
    });
  }
  export function get_incident_view(
    parent_work_order_no:string,
    start_date:string,
    end_date:string,
    ) {
    return api({
      url: '/api/report/get_incident_view/',
      method: 'post',
      data: {
        parent_work_order_no,
        start_date,
        end_date
      },
      responseType: 'blob',
    });
  }
  export function getreportweeks(
    parent_work_order_no:string,
    report_date:string
    ) {
    return api({
      url: '/api/report/get_cm_weekly_summary/',
      method: 'post',
      data: {
        parent_work_order_no,
        report_date,
      },
      responseType: 'blob',
    });
  }
  export function upload_incident_view(file:File|null
    ) {
    const formData = new FormData()
    if(file){
      formData.append('file', file)
    }
    return api({
      url: '/api/report/upload_incident_view/',
      method: 'post',
      data:formData,
      headers: {
        'Content-Type': 'multipart/form-data'
      },
    });
  }
  export function upload_cm_weekly_summary(file:File|null
    ) {
    const formData = new FormData()
    if(file){
      formData.append('file', file)
    }
    return api({
      url: '/api/report/upload_cm_weekly_summary/',
      method: 'post',
      data:formData,
      headers: {
        'Content-Type': 'multipart/form-data'
      },
    });
  }
  
  // url: url('')+`${id}/`,
  // method: 'patch',
  // data:formData,
  // headers: {
  //   'Content-Type': 'multipart/form-data'
  // }